package com.xnew;

import com.xnew.dict.service.DictCommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class MemberSecurityCommandLineRunner implements CommandLineRunner {
    @Value("${spring.redisInitStatus}")
    private String redisInitStatus;

    @Autowired
    private DictCommonService dictCommonService;
    @Override
    public void run(String... args) throws Exception {
        //项目启动时会执行这里的任务 通常加载用于系统参数加载
        dictCommonService.initDictToRedisResult();
//        dictCommonService.initUserPassword();
        if("2".equals(redisInitStatus)){
            //初始化机构名称，仅执行一次
//            dictCommonService.buildOrgAllName();
            //初始化机构用户信息
//            dictCommonService.initOrgAndUserResult();
            //初始化用户信息，仅执行一次
		    dictCommonService.initUserPassword();
        }
    }
}
